{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1d. Change the identity of \"X\"\n", "\n", "In this example we will change the chemical identity of \"X\" using the Pvsat calculator, but this can be done in the same way for any calculation type in VolFe.\n", "\n", "- \"X\" is an unreactive melt species whose identity can be changed. \n", "- The chemical identity of \"X\" is decided by its molecular mass, fugacity coefficient, and solubility constant.\n", "- Current options for \"X\" in VolFe are Ar and Ne in basalt and rhyolite. \n", "- By default, \"X\" is Ar in basalt." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python set-up\n", "You need to install VolFe once on your machine, if you haven't yet. Then we need to import a few Python packages (including VolFe). " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Install VolFe on your machine.\n", "# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.\n", "\n", "# import python packages\n", "import pandas as pd\n", "import VolFe as vf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Options for \"X\"\n", "\n", "We can look up the options for \"X\". Firstly, what solubility function are available, which are right at the end under 'Model options for species X solubility'." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on function C_X in module VolFe.model_dependent_variables:\n", "\n", "C_X(\n", " PT,\n", " melt_wf,\n", " models= option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[78 rows x 1 columns]\n", ")\n", " Solubility constant for disolving X in the melt: C_X = wmX/fX (ppmw/bar).\n", "\n", "\n", " Parameters\n", " ----------\n", " PT: dict\n", " Pressure (bars) as \"P\" and temperature ('C) as \"T\".\n", "\n", " melt_wf: dict\n", " Melt composition (SiO2, TiO2, etc.), not normally used unless model option\n", " requires melt composition.\n", "\n", " models: pandas.DataFrame\n", " Minimum requirement is index of \"species X solubility\" and column label of\n", " \"option\".\n", "\n", " Returns\n", " -------\n", " float\n", " Solubility constant for X in ppmw/bar\n", "\n", "\n", " Model options for species X solubility\n", " -------------\n", " - 'Ar_Basalt_HughesIP' [default] Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " - 'Ar_Rhyolite_HughesIP' Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " - 'Ne_Basalt_HughesIP' Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " - 'Ne_Rhyolite_HughesIP' Hughes et al. (in prep) based on data from Iacono-Marziano et al. (2010) Chemical Geology 279(3–4):145-157\n", " - [float: user specified number] User can type a number that will be used instead (i.e., a constant value)\n", "\n" ] } ], "source": [ "help(vf.C_X)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also look up the fugacity coefficient options available:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on function y_X in module VolFe.model_dependent_variables:\n", "\n", "y_X(\n", " PT,\n", " models= option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[78 rows x 1 columns]\n", ")\n", " Fugacity coefficient for X.\n", "\n", " Parameters\n", " ----------\n", " PT: dict\n", " Pressure (bars) as \"P\" and temperature ('C) as \"T\".\n", "\n", " models: pandas.DataFrame\n", " Minimum requirement is index of \"y_X\" and \"ideal_gas\" and column label of\n", " \"option\".\n", "\n", " Returns\n", " -------\n", " float\n", " Fugacity coefficient for X\n", "\n", "\n", " Model options for y_X\n", " -----------------------\n", " - \"ideal\" Treat as ideal gas, y = 1 at all P.\n", " Only one option available currently, included for future development.\n", " Note: \"ideal_gas\" = \"True\" overides chosen option.\n", "\n" ] } ], "source": [ "help(vf.y_X)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the inputs\n", "\n", "For this example, we'll use analysis TN273-01D-01-01 from Brounce et al. (2014) and Cottrell et al. (2021), with a temperature chosen as 1200 °C but add 20 ppm \"X\"." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Sample T_C SiO2 TiO2 Al2O3 FeOT MnO MgO CaO Na2O \\\n", "0 TN273-01D-01-01 1200.0 56.98 1.66 15.52 9.47 0.24 2.96 6.49 4.06 \n", "\n", " K2O P2O5 H2O CO2ppm STppm Xppm Fe3FeT \n", "0 0.38 0.22 1.88 13.0 362.83 20.0 0.155 \n" ] } ], "source": [ "# Define the melt composition, fO2 estimate, and T as a dictionary.\n", "my_analysis = {'Sample':'TN273-01D-01-01',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 56.98, # wt%\n", " 'TiO2': 1.66, # wt%\n", " 'Al2O3': 15.52, # wt%\n", " 'FeOT': 9.47, # wt%\n", " 'MnO': 0.24, # wt%\n", " 'MgO': 2.96, # wt%\n", " 'CaO': 6.49, # wt%\n", " 'Na2O': 4.06, # wt%\n", " 'K2O': 0.38, # wt%\n", " 'P2O5': 0.22, # wt%\n", " 'H2O': 1.88, # wt%\n", " 'CO2ppm': 13., # ppm\n", " 'STppm': 362.83, # ppm\n", " 'Xppm': 20., # ppm *** 20 ppm \"X\" added**\n", " 'Fe3FeT': 0.155}\n", "\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# Show the DataFrame.\n", "print(my_analysis)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run the calculation\n", "\n", "### Ar in basalt\n", "\n", "By default, \"X\" is Ar in basalt." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "577.029568 | \n", "57.038397 | \n", "1.661701 | \n", "15.535906 | \n", "9.479706 | \n", "0.240246 | \n", "2.963034 | \n", "6.496651 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-02 09:30:02.918755 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "373.224425 | \n", "57.038397 | \n", "1.661701 | \n", "15.535906 | \n", "9.479706 | \n", "0.240246 | \n", "2.963034 | \n", "6.496651 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-02 09:31:08.311493 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "460.29012 | \n", "57.038397 | \n", "1.661701 | \n", "15.535906 | \n", "9.479706 | \n", "0.240246 | \n", "2.963034 | \n", "6.496651 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-02 09:32:53.992964 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "351.507227 | \n", "57.038397 | \n", "1.661701 | \n", "15.535906 | \n", "9.479706 | \n", "0.240246 | \n", "2.963034 | \n", "6.496651 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-02 09:33:33.612770 | \n", "
1 rows × 173 columns
\n", "